<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>店面诊断结果详细管理</title>
	<meta name="decorator" content="default"/>
	<style type="text/css">
	  	 #btnSubmit {margin-left:350px;width:200px;}
	  	 .table{
	  		width:90%;margin:auto;
	  		margin-bottom:20px;
	  	  }
	  	  .table td {
			padding: 8px;
			line-height: 20px;
			text-align: center;
			vertical-align: middle;
			border-top: 1px solid #ddd;
		  }
	</style>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#contentTable tbody tr").click(function(){
				$("#contentTable tbody tr").removeClass("select_active");
				$(this).addClass("select_active");
			});
			$("#contentTable tbody tr:first-child").click();
			$("#searchForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			$("body").height($('#right', parent.document).height()-5);
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<div data-role="navbar">
	    <ul>
	    	<li><a href="${ctx}/sms/storeDiagnose/">店面诊断历史记录</a></li>
	        <li><a href="${ctx}/sms/storeDiagnose/form"  class="ui-btn-active">店面诊断</a></li>
	    </ul>
	</div>	
	<c:if test="${not empty message}">
	<div>${message}</div>
	</c:if>
	<c:if test="${empty message}">
	<tags:message content="${message}"/>
	<form:form id="searchForm" modelAttribute="storeDiagnose" action="${ctx}/sms/storeDiagnose/save" method="post" class="form-search">
		<form:hidden path="id"/>
		<div class="buttons">
			<input id="btnSubmit" type="submit" value="诊断" data-inline="true"/>
			<a href="${ctx}/sms/storeDiagnose/" data-role="button" data-inline="true">返回</a>
		</div>
		<table id="contentTable" data-role="table" class="ui-responsive table-stroke">
			<thead><tr><th>分类</th><th>项目</th><th>实际值</th></tr></thead>
			<tbody>
			<c:set value="0" var="index"/>
			<c:forEach items="${templateDetailMap}" var="map">
				<c:forEach items="${map.value}" var="templateDetail" varStatus="vstatus">
					<input name="detailList[${index}].storeDiagnoseTemplateDetail.id" type="hidden" value="${templateDetail.id}"/>&nbsp;
					<tr>
						<c:if test="${vstatus.first}">
							<td  rowspan="${fn:length(map.value)}">${templateDetail.item_group}</td>
						</c:if>
						<td>${templateDetail.item}</td>
						<td><input name="detailList[${index}].real_value" type="text" value="0" class="required number"/></td>
					</tr>
					<c:set value="${index + 1}" var="index"/>
				</c:forEach>
			</c:forEach>
			</tbody>
		</table>
	</form:form>
	</c:if>
</body>
</html>
